package cn.inst.common.untils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUntils {
	static Calendar calendar=Calendar.getInstance();
	/**
	 * 获取现在的时间(星期几)
	 * @return
	 */
	public static int getWeek(){
		
		calendar.setTime(new Date());
		int week=calendar.get(Calendar.DAY_OF_WEEK)-1;
		return week>0?week:7;
	}
	
	/**
	 * 获取时间差
	 * @param startDate
	 * @param endDat
	 * @return
	 */
	public static int getGap(Date startDate,Date endDat){
		long start = startDate.getTime();
		long end = endDat.getTime();
		int gap=(int) (end-start/(1000*60));
		return gap;
		
	}
	/**
	 * 获取上下午分界时间
	 * @param hour
	 * @param minute
	 * @return
	 */
	public static Date getSepDate(int hour,int minute){
		calendar.set(Calendar.HOUR_OF_DAY, hour);
		calendar.set(Calendar.MINUTE, minute);
		return calendar.getTime();
	}
	
}
